package dl.bukkit.myststus.function.trigger.imp;

import dl.bukkit.myststus.api.event.TaskEvent;
import dl.bukkit.myststus.configuration.imp.Config;
import dl.bukkit.myststus.library.ats.GComponent;
import dl.bukkit.myststus.function.trigger.TriggerHud;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;

@GComponent(
        key = "task",
        author = "DogLong"
)
public class TaskTrigger extends TriggerHud<TaskEvent> {
    @Override
    public boolean isRemove(TaskEvent event) {
        return getPlayer(event).isDead();
    }

    @Override
    public Class<TaskEvent> getEvent() {
        return TaskEvent.class;
    }

    @Override
    public Player getPlayer(TaskEvent event) {
        return event.getPlayer();
    }

    @Override
    public Entity getTarget(TaskEvent event) {
        return event.getPlayer();
    }

    @Override
    public boolean isRegister() {
        return Config.getInst().getBoolean("Trigger.Task.Enable");
    }
}
